home *** CD-ROM | disk | FTP | other *** search
/ Young Minds / Young Minds Interactive CD-ROM.ISO / mpss / mpss.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-07-20  |  895 b   |  53 lines

  1.  
  2. #include <stdio.h>
  3. #include "files.h"
  4.  
  5. main(argc,argv)
  6. int argc;
  7. char *argv[];
  8. {
  9. int i;
  10. char c;
  11. char *tnam;
  12. char terminalfile[14];
  13.  
  14. i=umask(000); /*to make sure files are created with the right permissions.*/
  15.  
  16.  
  17.     if (isatty(1)!=1)
  18.     {
  19.     fprintf(stdout,"                  You cannot play from a file\n");
  20.     exit(0);
  21.     }
  22.  
  23.     tnam=(char *)ttyname(1);
  24.     strcpy(terminalfile,tnam);
  25.     
  26.     /*Now make the terminal file rw access for everyone!*/
  27.  
  28.     if (chmod(terminalfile, 0666)<0)
  29.     {
  30.     fprintf(stdout,terminalfile);
  31.     fprintf(stdout,"                   : cannot chmod your terminal file!!!\n");
  32.     exit(0);
  33.     }
  34.     
  35.     if (argc==1)
  36.     execl(SLAVEPROGRAM,"slave",(char *) 0);
  37.     else
  38.         {
  39.         if (argc==2)
  40.         execl(SLAVEPROGRAM,"slave",argv[1],(char *) 0);
  41.             else
  42.             {
  43.             if (argc==3)
  44.             execl(SLAVEPROGRAM,"slave",argv[1],argv[2],(char *) 0);
  45.             else
  46.             {
  47.             fprintf(stderr,"Usage: mpss {-i} {-t}\n");
  48.             exit(0);
  49.             }
  50.             }
  51.         }
  52. }
  53.